package com.lagou.io;

import org.apache.commons.lang3.StringUtils;

import java.io.InputStream;

/**
 * @author: lcz
 * @date: Created in 13:36 2020/9/25
 * @description:
 */
public class Resource {

    /**
     * @author: lcz
     * @date: Created in 13:37 2020/9/25
     * @description: 根据路径获取流文件，存储在内存中
     */
    public static InputStream getResourceAsStream(String path) {
        if (StringUtils.isEmpty(path)) {
            throw new RuntimeException("the resource path cannot be empty");
        }
        return Resource.class.getClassLoader().getResourceAsStream(path);
    }
}
